package com.chasingtheiron.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.RootPanel;

public class Main implements EntryPoint {

    public void onModuleLoad() {

        RootPanel.get().add(new HTML("Hello World from javascript"));

        // Eric - As you can see Java 1.6 does not support delegates or lamda expressions
        // if it did, this code would look much prettier. Java 1.7 is suppose to add this
        // and hopefully should come out this year. If IBM buys SUN who knows how long
        // it will take to happen.
        BasicRPC.Util.getInstance().GetMessage(new AsyncCallback<String>() {

            public void onFailure(Throwable caught) {
                RootPanel.get().add(new HTML(caught.toString() + " from the server"));
            }

            public void onSuccess(String result) {
                RootPanel.get().add(new HTML(result.toString() + " from the server"));
            }
        });
    }

}
